/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package IA;

import java.util.*;

/**
 *
 * @author Jeremy
 */
public class WaitingParty extends ClockObserver {
    private int _NumCustomers;
    private int _EatTime;
    public WaitingParty(int NumCustomers, int EatTime) {
        _NumCustomers = NumCustomers;
        _EatTime = EatTime;
        SystemClock.getInstance().AddObserver(this);
    }
    
    public int getEatTime() {return _EatTime;}
    
    public int getWaitingTime() {return (int)super.NumTicks;}

    public int getNumCustomers() {return _NumCustomers;}
    
    public static Comparator getWaitingTimeComparator() {
        return new Comparator() {

            @Override
            public int compare(Object o1, Object o2) {
                WaitingParty p1 = (WaitingParty)o1; WaitingParty p2 = (WaitingParty)o2;
                if(p1.getWaitingTime() < p2.getWaitingTime()) return 1;
                else {
                    if(p1.getWaitingTime() == p2.getWaitingTime()) return 0;
                    else return -1;
                }
            }
            
        };
    }
    

}
